package com.jq.aution.controller;

import com.jq.aution.controller.model.UserLoginForm;
import com.jq.aution.controller.model.UserRegisterForm;
import com.jq.aution.service.ProductInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 页面跳转控制器
 * Created by jiangqi on 2020/09/02
 */
@Controller
@RequestMapping(value = "/index")
public class IndexController {
    @Autowired
    ProductInfoService productInfoService;

    /**
     * 跳转到登录页面
     * @param userLoginForm
     * @return
     */
    @RequestMapping("/login")
    public String enterLogin(@ModelAttribute UserLoginForm userLoginForm, @ModelAttribute UserRegisterForm userRegisterForm){
        return "login";
    }

    @RequestMapping("/products")
    public String enterProducts(Model model){
        model.addAttribute("productList",productInfoService.getList());
        return "seacher";
    }
}
